//
//  UIImage+LKRescale.m
//  LKCategories
//
//  Created by LIUKUN-PC on 16/5/20.
//  Copyright © 2016年 liukun. All rights reserved.
//

#import "UIImage+LKRescale.h"

@implementation UIImage (LKRescale)

- (UIImage *)rescaleImageWithScale:(CGFloat)scale {
    
    CGSize size = CGSizeMake(self.size.width * scale, self.size.height * scale);
    return [self rescaleImageWithCGSize:size];
}

- (UIImage *)rescaleImageWithCGSize:(CGSize)size {
    
    CGRect rect = CGRectMake(0.0, 0.0, size.width, size.height);
    
    UIGraphicsBeginImageContext(rect.size);
    
    [self drawInRect:rect];  
    
    UIImage *resImage = UIGraphicsGetImageFromCurrentImageContext();
    
    UIGraphicsEndImageContext();
    
    return resImage;
}

@end
